package jjn.acwing.java_basic;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/9/3 18:45
 */
public class Acwing719 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                int y = sc.nextInt();
                int max = Math.max(x, y);
                int min = Math.min(x, y);
                int total = 0;
                for (int j = min + 1; j < max; j++) {
                    if (j % 2 == 1 || j % 2 == -1) {
                        total += j;
                    }
                }
                System.out.println(total);
            }
        }
    }
}
